/*
 * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
 * http://www.gnu.org/licenses/gpl-3.0.html
 */

#ifndef ENVVARS_CFGDLG_H
#define ENVVARS_CFGDLG_H

#include <wx/event.h>
#include <wx/string.h>
#include <wx/window.h>

#include "configurationpanel.h"

class EnvVars;
class wxChoice;

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----

class EnvVarsConfigDlg : public cbConfigurationPanel
{
public:
  /// Ctor
           EnvVarsConfigDlg(wxWindow* parent);
  /// Dtor
  virtual ~EnvVarsConfigDlg()
  { };

  /// returns the title of the plugin configuration panel
  /// 返回插件配置面板的标题
  virtual wxString GetTitle() const
  { return wxT("环境变量"); }

  /// returns the title of the plugin's bitmap to use for configuration dialog
  /// 返回要用于配置对话框的插件位图的标题
  virtual wxString GetBitmapBaseName() const
  { return _T("envvars"); }

protected:
  /// Fires if the UI is being updated (wx event)
  /// 在更新UI时激发(wx事件)
  void OnUpdateUI         (wxUpdateUIEvent& event);

private:
  /// Fires if the "apply" button is pressed inside C::B settings
  /// 如果在C::B设置中按下"应用"按钮,则激发
  virtual void OnApply()
  { SaveSettings(); }

  /// Fires if the "cancel" button is pressed inside C::B settings
  /// 如果在C::B设置中按下"取消"按钮,则激发
  virtual void OnCancel()
  { ; }

  /// Load all settings (envvar sets) from global C::B config
  /// 从全局C::B配置加载所有设置(环境变量集)
  void LoadSettings();
  /// Save all settings (envvar sets) to global C::B config
  /// 将所有设置(环境变量集)保存到全局C::B配置
  void SaveSettings();
  /// Save settings (of specific active envvar set) to global C::B config
  /// 将设置(指定激活的环境变量集)保存到全局C::B配置
  void SaveSettingsActiveSet(wxString active_set);

  /// Fires when a (new) envvar set is selected
  /// 在选择(新)环境变量集时激发
  void OnSetClick         (wxCommandEvent&  event);
  /// Fires when the button to create an envvar set is pressed
  /// 当按下创建环境变量集的按钮时激发
  void OnCreateSetClick   (wxCommandEvent&  event);
  /// Fires when the button to clone an envvar set is pressed
  /// 在按下克隆环境变量集的按钮时激发
  void OnCloneSetClick    (wxCommandEvent&  event);
  /// Fires when the button to remove an envvar set is pressed
  /// 当按下删除环境变量集的按钮时激发
  void OnRemoveSetClick   (wxCommandEvent&  event);

  /// Fires when the checkbox to toggle an envvar is changed
  /// 当切换环境变量的复选框更改时激发
  void OnToggleEnvVarClick(wxCommandEvent&  event);
  /// Fires when the button to add an envvar is pressed
  /// 当按下添加环境变量的按钮时激发
  void OnAddEnvVarClick   (wxCommandEvent&  event);
  /// Fires when the button to edit an envvar is pressed
  /// 当按下编辑环境变量的按钮时激发
  void OnEditEnvVarClick  (wxCommandEvent&  event);
  /// Fires when the button to delete an envvar is pressed
  /// 当按下删除环境变量的按钮时激发
  void OnDeleteEnvVarClick(wxCommandEvent&  event);
  /// Fires when the button to clear all envvars is pressed
  /// 当按下清除所有环境变量的按钮时激发
  void OnClearEnvVarsClick(wxCommandEvent&  event);
  /// Fires when the button to set all envvars is pressed
  /// 当按下设置所有环境变量的按钮时激发
  void OnSetEnvVarsClick  (wxCommandEvent&  event);

  /// Verifies that an envvar set is unique
  /// 验证环境变量集是否唯一
  bool VerifySetUnique(const wxChoice* choSet, wxString set);
  ///声明事件表
  DECLARE_EVENT_TABLE()
};

#endif // ENVVARS_CFGDLG_H
